class Solution {
    public boolean isPalindrome(int x) {
        if(x < 0) return false;
        String str = Integer.toString(x);
        int length = str.length();
        if(length == 1) return true;
        int left = 0,rigth = length - 1;
        while(left<rigth) {
            if(str.charAt(left) == str.charAt(rigth)) {
                left++;
                rigth--;
            } else {
                return false;
            }
        }
        return true;
    }
}